package com.dhl.cloud.core.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhl.cloud.common.vdo.DicinfoDetailBean;
import com.dhl.cloud.core.dao.DicinfoMapper;
import com.dhl.cloud.core.entity.Dicinfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class DicinfoService {

    @Autowired
    private DicinfoMapper dicinfoMapper;

	public boolean deleteByPrimaryKey(Integer id){
		return dicinfoMapper.deleteByPrimaryKey(id)==1;
	};

	public boolean insert(Dicinfo record){
		return dicinfoMapper.insert(record)==1;
	};

	public boolean insertSelective(Dicinfo record){
		return  dicinfoMapper.insertSelective(record)==1;
	};

	public Dicinfo selectByPrimaryKey(Integer id){
		return dicinfoMapper.selectByPrimaryKey(id);
	};

	public boolean updateByPrimaryKeySelective(Dicinfo record){
		return dicinfoMapper.updateByPrimaryKeySelective(record)==1;
	};

	public boolean updateByPrimaryKey(Dicinfo record){
		return dicinfoMapper.updateByPrimaryKey(record)==1;
	};

	/**
	 * 获取字典内容列表
	 * @param systemstate
	 * @return
	 */
	public List<Dicinfo> getDicInfoList(String systemstate){
		return dicinfoMapper.getDicInfoList(systemstate);
	}

	public DicinfoDetailBean getDicInfo(Integer id) {
		return dicinfoMapper.getDicInfo(id);
	}

	/**
	 * 获取字典内容列表分页
	 * @param systemstate
	 * @param pagenum
	 * @param pagesize
	 * @return
	 */
    public PageInfo<Dicinfo> getDicInfoListPages(String systemstate, Integer pagenum, Integer pagesize) {
		PageHelper.startPage(pagenum, pagesize);
		List<Dicinfo> list = dicinfoMapper.getDicInfoList(systemstate);
		PageInfo<Dicinfo> pageinfo = new PageInfo(list);
		return pageinfo;
    }
}
